<template>
  <div>
    <div class="whiteBg" @click="hide">
      <div class="padding_common">
        <!-- 轮播图 -->
        <slide-img :divStyle="0" :bannerArry='banner'></slide-img>
      </div>
      <div class="coupon_dtl_tab">
        <p :class="{hot:indexTab == 0}" @click="tabSwitch(0)"><span>套餐详情</span></p>
        <p :class="{hot:indexTab == 1}" @click="tabSwitch(1)"><span>商家信息</span></p>
      </div>
    </div>
    <div class="couponDtlTab1" v-show="indexTab == 0 ">
      <div class="whiteBg" @click="hide">
        <div class="coupon_dtl_coupon">
          <div class="yun_price" v-if="couponParam.promAppro!='buy'">
            <span>{{couponParam.valuation || '0'}}</span>芸券
          </div>
          <div class="yun_price" v-if="couponParam.promAppro=='buy'">
            <span>{{couponParam.cash || '0'}}</span>元
          </div>
          <div class="couponDiv">
            <coupon-denomination :item="couponParam"></coupon-denomination>
          </div>
          <div class="card_info">
            <div class="card_name">
              {{couponParam.couponName}}
            </div>
            <div class="coupon_info_item">
              <star :couponComScore="couponParam.comScore"></star>
              <p class="info_pad" v-if="!$route.query.surplusnum">{{couponParam.comNum || 0}}条 &nbsp;&nbsp;&nbsp;&nbsp;剩余{{couponParam.sellNum || 0}}张</p>
              <p class="info_pad" v-if="$route.query.surplusnum">{{couponParam.comNum || 0}}条 &nbsp;&nbsp;&nbsp;&nbsp;剩余 {{surplusnum}}张</p>

            </div>
            <div class="clear"></div>
            <div class="coupon_info_item color_gray">
              <div class="left" v-if="couponParam.usrId">
                <div class="coupon_dtl_avatar"><img :src="couponParam.usrPicUrl"></div>
                {{couponParam.usrName}}
              </div>
              <img v-if="couponParam.promAppro=='buy'" style="width: 1rem;height:1rem;z-index: 4;"
                   src="../../images/cashIcon.png"/>
              <img v-if="couponParam.couponTypes=='third'" style="width: 1rem;height:1rem;z-index: 4;"
                   src="../../images/dui.png"/>
              <span :class="{right:couponParam.usrId}">已售出  &nbsp;&nbsp;{{couponParam.soldnum}}  &nbsp;已使用  &nbsp;&nbsp;{{couponParam.usednum}}</span>
            </div>
          </div>
        </div>
        <div class="coupon_dtl_tit">使用须知</div>
        <div class="coupon_dtl_instr">
          <ul>
            <li v-if="scpoe"><span>{{scpoe + extra}}</span></li>
            <li><span>有效期{{couponParam.validatyBegin | strDate(3)}}至{{couponParam.validatyEnd | strDate(3)}}</span></li>
            <li v-if="couponParam.disableDate"><span>{{couponParam.disableDate | businessDay}}不可以使用</span></li>
            <li><span>使用时间：{{userTime | timeAnalysis}}</span></li>
            <li v-if="couponParam.restricted"><span>满{{couponParam.restricted}}元可使用</span></li>
          </ul>
        </div>
        <div class="coupon_dtl_instr2">
          <ul>
            <li v-if="diejia"><i class="iconfont icon-kediejiashiyong-"></i>可叠加使用{{couponParam.useNum}}张</li>
            <li v-if="gongtong"><i class="iconfont icon-keyuqitadianziquangongtongshiyong-"></i>可与其他电子券同时使用</li>
            <li><i class="iconfont icon-buzhaolingbuduixian-"></i>不找零不兑现</li>
          </ul>
        </div>
      </div>

      <div v-if="!replyNum.couponComNum" class="whiteBg mgt10 no_comment">暂无评论</div>
      <div v-show="replyNum.couponComNum>0" ref="commBox" class="whiteBg marTop" @click="hide">
        <div class="aboutComments">
          <a @click="replyJump(couponDetail)">
            <i class="icon iconfont icon-right right"></i>关于电子券的评论 ({{replyNum.couponComNum || 0}})
          </a>
        </div>
        <div class="coupon_dtl_tag">
          <p :class="indexCom==3?'tag_all':'tag_good'" @click="tabCom(3, 0)">全部({{replyNum.couponComNum || 0}})</p>
          <p :class="indexCom==0?'tag_all':'tag_good'" @click="tabCom(0, 0)">
            满意({{replyNum.couponComStar45Num || 0}})</p>
          <p :class="indexCom==1?'tag_all':'tag_good'" @click="tabCom(1, 0)">一般({{replyNum.couponComStar3Num || 0}})</p>
          <p :class="indexCom==2?'tag_all':'tag_bad'" @click="tabCom(2, 0)">
            不满意({{replyNum.couponComStar12Num || 0}})</p>
        </div>
      </div>
      <comments v-show="replyNum.couponComNum>0" @clickPub="publishFocus" @clickBlur="hide"
                :commentList="couponComments" :replyStyle="indexTab" :mchtId="couponParam.mchtId"></comments>
      <a v-if="replyNum.couponComNum>0" @click="replyJump(couponDetail)" class="viewAllCom"><i
          class="icon iconfont icon-right right"></i>查看全部券友评论</a>
    </div>
    <!-- 关于商家的信息-->
    <div class="couponDtlTab1" v-show="indexTab == 1 ">
      <div class="whiteBg" @click="hide">
        <div class="merInfo">
          <div class="card_name">
            {{mcht.mchtSearch.name || mchtInfo.mchtName}}
          </div>
          <!-- <div class="coupon_info_item">
                          <star :couponComScore="mcht.mchtSearch.mchtComScore||mchtInfo.mchtComScore"></star>
                          <p class="info_pad info_pad_shop">{{mcht.mchtSearch.mchtComNum||mchtInfo.mchtComNum||0}}条</p>
                      </div> -->
          <div class="shop_core clearfix">
            <star :couponComScore="mcht.mchtSearch.mchtComScore||mchtInfo.mchtComScore"></star>
            <p class="new_num">{{mcht.mchtSearch.mchtComNum || mchtInfo.mchtComNum || 0}}条</p>
          </div>
          <div class="coupon_info_item">
            <!-- <span v-if="mcht.flag=='false'" class="right">{{mcht.mchtSearch.distance | setDistance}}</span> -->
            <span v-if="mcht.flag" class="right">{{mcht.mchtSearch.distance | setDistance}}</span>
            <span class="right" style="margin-right: 0.5rem;">{{mcht.mchtSearch.mchtArea || mchtInfo.mchtArea}}</span>
            <span class="red_color">￥{{mcht.mchtSearch.mchtPer || mchtInfo.mchtPer}}/人</span><span
              class="pad_l">{{mcht.mchtTypeValue}}</span>
          </div>
        </div>
        <div class="mer_position">
          <a :href="telephone" class="phoneBtn">
            <i class="icon iconfont icon-dianhua-"></i>
          </a>
          <div @click="getPosition">
            <i class="icon iconfont icon-location left"></i>
            <p><span>{{mcht.mchtSearch.mchtAddr || mchtInfo.mchtAddr}}</span></p>
          </div>
        </div>
        <div class="shop_timer">
          <i class="icon iconfont icon-shijian- left"></i>
          <p>
            <span>{{mcht.mchtBusTime}}  {{mcht.mchtBusDay | businessDay}}</span><br/>
            <span
                v-if="mcht.mchtBusDay2&&mcht.mchtBusTime2">{{mcht.mchtBusTime2}}  {{mcht.mchtBusDay2 | businessDay}}</span>
          </p>
        </div>
        <div class="shop_branch" @click="lookbranth(mchtInfo)" v-if="mcht.num>0">
          <i class="icon iconfont icon-shanghu- left"></i>
          <a class="icon iconfont icon-right right"></a>
          <p>其他{{mcht.num || 0}}家分店</p>
        </div>
      </div>

      <div v-if="!replyShopNum.mchtComNum" class="whiteBg mgt10 no_comment">暂无评论</div>
      <div v-show="replyShopNum.mchtComNum>0" ref="commBox" class="whiteBg marTop" @click="hide">
        <div class="aboutComments">
          <a @click="replyShopJump(couponDetail)">
            <i class="icon iconfont icon-right right"></i>关于商家的评论 ({{replyShopNum.mchtComNum || 0}})
          </a>
        </div>
        <div class="coupon_dtl_tag">
          <p :class="indexCom==3?'tag_all':'tag_good'" @click="tabCom(3, 1)">全部({{replyShopNum.mchtComNum || 0}})</p>
          <p :class="indexCom==0?'tag_all':'tag_good'" @click="tabCom(0, 1)">
            满意({{replyShopNum.mchtComStar45Num || 0}})</p>
          <p :class="indexCom==2?'tag_all':'tag_bad'" @click="tabCom(2, 1)">
            不满意({{replyShopNum.mchtComStar12Num || 0}})</p>
          <p :class="indexCom==1?'tag_all':'tag_good'" @click="tabCom(1, 1)">
            一般({{replyShopNum.mchtComStar3Num || 0}})</p>
          <p :class="indexCom==4?'tag_all':'tag_good'" @click="tabCom(4, 1)">有图({{replyShopNum.mchtPicNum || 0}})</p>
        </div>
      </div>
      <comments v-show="replyShopNum.mchtComNum>0" @clickPub="publishFocus" @clickBlur="hide"
                :commentList="shopComments" :replyStyle="indexTab" :mchtId="couponParam.mchtId"
                :allStatus="allStatus"></comments>
      <a v-if="replyShopNum.mchtComNum>0" @click="replyShopJump(couponDetail)" class="viewAllCom"><i
          class="icon iconfont icon-right right"></i>查看全部券友评论</a>
    </div>
    <!-- 评论框 -->
    <div v-show="boxStatus" :class="!$route.query.type?'comment_box commet_fix':'comment_box'">
      <input id="inputId" ref="inputId" @focus="inputFixed" v-model="commentCont" class="left" type="text"
             placeholder="写点评论吧"/>
      <span @click="publish()" class="comment_box_btn right">发表</span>
    </div>

    <div class="botSpace"></div>
    <div class="exchangeBtn" v-if="!$route.query.type||$route.query.buy">
      <!--<span><svg aria-hidden="true" class="icon"><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-fenxiangyaoqingma"></use></svg></span>-->
      <span @click="collection">
                <svg v-show="!collectStatus" aria-hidden="true" class="icon">
                    <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-shoucang-"></use>
                </svg>
                <svg v-show="collectStatus" aria-hidden="true" class="icon color_ec">
                    <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-shoucangfuben"></use>
                </svg>
            </span>
      <a @click="exchange" v-if="!$route.query.buy&&!$route.query.buys" class="mainBtn"
         :class="{'disBtn':!couponParam.usrId}">立即兑换</a>
      <a @click="exchange" v-if="$route.query.buys" class="mainBtn">立即兑换</a>
      <a @click="exchange" v-if="$route.query.buy" class="mainBtn">立即购买</a>
    </div>
  </div>
</template>
<script>
  import Vue from 'vue'
  import header from '../../componentes/global/header.vue'
  import slideImg from '../../componentes/global/slideImg.vue'
  import comments from '../../componentes/global/comments.vue'
  import star from '../../componentes/global/star.vue'
  import couponNum from '../../componentes/global/couponNum.vue'
  import getData from '../../service/getData.js'
  import getData2 from '../../service/getData2.js'
  import getData4 from '../../service/getData4.js'
  import * as types from '../../vuex/types.js'
  import share from "../../componentes/global/share.vue" // 分享模块
  import {
    mapState
  } from 'vuex'
  import {
    Toast,
    MessageBox,
    Indicator
  } from 'mint-ui'
  import {
    Common
  } from 'src/utils/common.js'
  import {
    Storage
  } from 'src/utils/storage.js'

  export default {
    name: 'coupon-detail',
    data() {
      return {
        shareState: false, // 分享提示开关
        indexTab: 0,
        replyNum: '',
        replyShopNum: '',
        diejia: '',
        gongtong: '',
        userTime: '',
        mcht: {
          mchtSearch: {}
        },
        replyStyle: '',
        indexCom: 3,
        commId: '',
        commentCont: '',
        boxStatus: false,
        picture: '',
        allStatus: true,
        collectStatus: false,
        collectIndex: '',
        param: {},
        couponParam: {},
        telephone: '',
        extra: '',
        banner: [],
        scpoe: "",
        mchtInfo: {},
        surplusnum: ''
      }
    },
    watch: {
      couponParam: {
        deep: true,
        handler(val) {
          if (val.couponName) {
          }
        }
      }
    },
    components: {
      slideImg,
      comments,
      star,
      couponNum,
      share
    },
    created: function () {
      this.$store.commit(types.SHOP_COMMENTS); //初始化列表
      this.$store.commit(types.COUPON_COMMENTS); //初始化列表
      this.$store.commit("COUPON_PAGES"); //评论分页初始化
      //电子券详情
      let me = this;
      var route = this.$route.query,
        store = Storage.get("couponInfo");
      me.surplusnum = this.$route.query.surplusnum
      let data = this.$route.query
      this.param = {
        couponId: data.couponId,
        mchtId: data.mchtId.toString(),
        seqNo: data.seq.toString(),
        usrId: data.usrId.toString(),
        usrPicId: data.usrPicId.toString()
      };
      this.$store.commit('changeState', true)
      //过滤使用须知
      getData4.getDishType({
        mchtId: me.param.mchtId
      }).then(data => {
        var scpoeList = data.content.lowTypeNameList;
        if (data.respCode != '00') {
          Toast({
            message: rep.errorInfo,
            duration: 800
          });
        }
        //电子券详情
        getData.getCouponInfo({
          "method": 'post',
          data: {
            "couponId": me.param.couponId,
            "mchtId": me.param.mchtId,
            "seqNo": me.param.seqNo,
            "usrId": me.param.usrId,
            "usrPicId": me.param.usrPicId
          }
        }).then(rep => {
          if (rep.respCode == '00') {
            rep.content.couponId = me.param.couponId;
            me.couponParam = rep.content;
            if (rep.content) {
              me.$store.commit(types.HEAD_TEXT, rep.content.couponName);
              me.diejia = rep.content.useRule.indexOf("M") >= 0;
              me.gongtong = rep.content.useRule.indexOf("D") >= 0;
              // me.userTime = rep.content.useTime.split(",").join(" ");
              me.userTime = rep.content.useTime;
              if (rep.content.scpoe.indexOf("T") >= 0) {
                me.extra = "不可用"
              } else {
                me.extra = "可用"
              }

              //获取商户可用或非可用菜类列表
              let scpoe = rep.content.scpoe.substr(1, rep.content.scpoe.length + 1).split(",")
              let type = [];
              scpoe.find(data => {
                scpoeList.forEach(value => {
                  if (value.typeId == data) {
                    type.push(value.typeName);
                  }
                })
                me.scpoe = type.join("、")
              })
            }
          } else {
            Toast({
              message: rep.errorInfo,
              duration: 800
            });
          }
        })
      });
      //获取商户菜单类型

      //商户详情  || '121.47,31.23'
      // console.log(me.position)
      var cityGet = Storage.get("city", true);
      getData.mchtNew({
        method: 'post',
        data: {
          cityName: cityGet,
          position: me.position
        },
        mchtId: me.param.mchtId
      }).then(rep => {
        if (!rep.content.mchtSearch) {
          getData.mchtNo({
            mchtId: me.param.mchtId
          }).then(rep => {
            me.mchtInfo = rep.content.mcht;
            me.mcht.mchtTypeValue = rep.content.mchtTypeValue;
            me.mcht.num = rep.content.num;
            me.mcht.mchtBusTime = rep.content.mcht.mchtBusTime.replace(/\s+/g, "")
            me.mcht.mchtBusDay = rep.content.mcht.mchtBusDay
            me.telephone = 'tel:' + rep.content.mcht.mchtTel1;
            me.mcht.mchtBusDay2 = rep.content.mcht.mchtBusDay2
            if (rep.content.mcht.mchtBusTime2) {
              me.mcht.mchtBusTime2 = rep.content.mcht.mchtBusTime2.replace(/\s+/g, "")
            }
          });
        } else {
          me.mcht = rep.content;
          me.mchtInfo = rep.content;
          me.mchtInfo.mchtId = rep.content.mchtSearch.id;
          me.mcht.mchtBusTime = me.mcht.mchtBusTime.replace(/\s+/g, "")
          me.telephone = 'tel:' + rep.content.mchtTel1;
          if (me.mcht.mchtBusTime2) {
            me.mcht.mchtBusTime2 = me.mcht.mchtBusTime2.replace(/\s+/g, "")
          }
        }
      });
      //关于电子券评论列表
      this.couponList();
      //判断有无收藏
      this.isCollected();
      //商户广告
      this.shopBanner();
    },
    computed: {
      ...mapState({
        userInfo: state => state.user.userInfo,
        couponInfo: state => state.coupon.couponInfo,
        couponComments: state => state.coupon.couponComments,
        shopComments: state => state.coupon.shopComments,
        couponDetail: state => state.coupon.couponDetail,
        setOwnerInfo: state => state.coupon.setOwnerInfo,
        position: state => state.coupon.position, //用户地理位置
      })
    },
    filters: {
      timeAnalysis: function (value) {
        if (!value) {
          return;
        }
        ;
        if (value.indexOf('null') > 0) {
          value = value.substring(0, value.indexOf(','));
        }
        return value
      }
    },
    methods: {
      clickIconShare(data) {
        this.shareState = true;
        console.log(data)
      },
      tabSwitch: function (num) {
        var me = this;
        this.indexTab = num;
        this.$store.commit(types.SHOP_COMMENTS); //初始化列表
        this.$store.commit(types.COUPON_COMMENTS); //初始化列表
        this.$store.commit("COUPON_PAGES"); //评论分页初始化
        if (num == 1) {
          this.indexCom = 3;
          //关于商户评论列表
          this.shopList();
        } else if (num == 0) {
          this.indexCom = 3;
          //关于电子券评论列表
          this.couponList();
        }
      },
      //关于电子券评论列表
      couponList: function () {
        var me = this;
        this.$store.dispatch("couponComments", {
          couponId: me.param.couponId,
          data: {
            "commStar": me.indexCom,
            "hasPic": "",
            "mchtId": me.param.mchtId,
          }
        }).then(function (rep) {
          me.replyNum = rep.content;
        })
      },
      //关于商户评论列表
      shopList: function () {
        var me = this;
        this.$store.dispatch("shopComments", {
          mchtId: me.param.mchtId,
          data: {
            "commStar": me.indexCom,
            "hasPic": me.picture,
            "mchtId": me.param.mchtId,
          }
        }).then(function (rep) {
          me.replyShopNum = rep.content;
        })
      },
      // 评论满意度切换
      tabCom(num, type) {  // type: 1: 商户 2: 电子券
        this.$router.push({
          name: 'commentAll',
          params: {
            mchtId: this.param.mchtId,
            couponId: this.param.couponId,
            replyStyle: type
          },
          query: {
            replyType: num
          }
        })
      },
      //关于电子券的评论跳转
      replyJump: function () {
        var me = this;
        this.replyStyle = 0;
        this.$router.push({
          'path': '/commentAll/' + me.param.mchtId + '/' + me.param.couponId + '/0'
        });
      },
      //关于商户的评论跳转
      replyShopJump: function () {
        var me = this;
        this.replyStyle = 1;
        this.$router.push({
          'path': '/commentAll/' + me.param.mchtId + '/' + me.param.couponId + '/1'
        });
      },
      exchange: function () {
        let me = this;
        if (!me.couponParam.usrId && !me.$route.query.buy && !me.$route.query.buys) {
          return
        }
        if (me.$route.query.buy) {
          this.$store.commit('changeState',true) // 动画
          this.$router.push({
            'name': 'exchange',
            query: {
              buy: true,
              surplusnum: me.$route.query.surplusnum
            }
          });
        } else if (me.$route.query.scanState) {
          this.$store.commit('changeState',true) // 动画
          this.$router.push({
            'name': 'exchange',
            query: {
              surplusnum: me.$route.query.surplusnum,
              scanState: me.$route.query.scanState,
              tlrNo: me.$route.query.tlrNo,
              inputAmt: me.$route.query.inputAmt,
              inputNoSlae: me.$route.query.inputNoSlae,
              inputDeskNum: me.$route.query.inputDeskNum
            }
          });
        } else {
          this.$store.commit('changeState',true) // 动画
          this.$router.push({
            'name': 'exchange'
          });
        }

      },
      //查看商户所在位置
      getPosition: function () {
        let me = this;
        var po_array = me.mcht.mchtSearch.position.split(" ");
        wx.openLocation({
          latitude: parseFloat(po_array[1]), // 纬度，浮点数，范围为90 ~ -90
          longitude: parseFloat(po_array[0]), // 经度，浮点数，范围为180 ~ -180。
          name: me.mcht.mchtSearch.name, // 位置名
          address: '', // 地址详情说明
          scale: 12, // 地图缩放级别,整形值,范围从1~28。默认为最大
          infoUrl: '' // 在查看位置界面底部显示的超链接,可点击跳转
        });
      },
      //点评论聚焦
      publishFocus: function (data) {
        this.commId = data.commId;
        this.commentUsrd = data.usrId;
        this.boxStatus = true;
        document.getElementById('inputId').focus();
      },
      // 点评论失焦
      hide: function () {
        this.boxStatus = false
      },
      // input聚焦
      inputFixed: function () {
        let me = this;
        let inputEl = me.$refs.inputId;
        setTimeout(function () {
          inputEl.scrollIntoView(true);
        }, 100)
        if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
          setTimeout(function () {
            console.log(document.body.scrollHeight)
            window.scrollTo(0, document.body.scrollHeight);
          }, 500)
        }
      },
      //发表
      publish: function (e) {
        var me = this;
        if (me.commentCont == '') {
          Toast({
            message: '内容不能为空',
            duration: 800
          });
          return false;
        }
        if (me.commentUsrd == me.userInfo.usrId) {
          Toast({
            message: '不能回复自己',
            duration: 800
          });
          return;
        }
        var baseComm = Base64.encode(me.commentCont);
        getData2.commentReply({
          'method': 'post',
          data: {
            commId: me.commId,
            dsc: baseComm
          }
        }, me.userInfo.usrId).then(rep => {
          if (rep.respCode == '00') {
            Toast({
              message: '回复成功',
              duration: 800
            });
            me.commentCont = ''
            me.boxStatus = false;
            if (me.indexTab == 0) {
              me.$store.commit("COUPON_PAGES");
              me.couponList();
            } else if (me.indexTab == 1) {
              me.$store.commit("COUPON_PAGES");
              me.shopList();
            }

          } else {
            Toast({
              message: '回复失败',
              duration: 800
            });
            me.boxStatus = false;
          }
        })
      },
      // 查看其他分店
      lookbranth: function (info) {
        // this.$router.push({'path':'/businessOther/'+info.mchtSearch.id+'/'+info.upperMchtId})
        this.$router.push({
          'path': '/businessOther/' + info.mchtId + '/' + info.upperMchtId
        })
      },
      //判断有无收藏
      isCollected: function () {
        var me = this;
        var collectStorage = {
          collectList: [],
          listId: [],
          usrId: ''
        };
        var collectArry = Storage.get("collect_info");
        // var couponCont = Storage.get("couponInfo");
        // console.log(collectArry);

        if (collectArry) {

          if (me.param.seqNo) {
            // console.log(collectArry.listId)
            for (var i = 0; i < collectArry.listId.length; i++) {
              if (me.param.seqNo == collectArry.listId[i]) {

                me.collectStatus = true;
                me.collectIndex = i;
                return;
              }
            }

            me.collectStatus = false;
          } else if (me.param.couponId) {
            var mosaic = me.param.mchtId + ',' + me.param.couponId;
            for (var i = 0; i < collectArry.listId.length; i++) {
              if (mosaic == collectArry.listId[i]) {
                me.collectStatus = true;
                me.collectIndex = i;
                return;
              }
            }
            me.collectStatus = false;
          }
        } else {
          me.collectStatus = false;
        }

      },
      // 收藏
      collection: function () {
        let me = this;
        var collectArry = Storage.get("collect_info") || {
          collectList: [],
          listId: [],
          usrId: ''
        };
        if (!collectArry.usrId) {
          collectArry.usrId = me.userInfo.usrId;
        }
        if (!this.collectStatus) {
          this.collectStatus = true;
          Toast({
            message: '收藏成功',
            duration: 800
          });

          collectArry.collectList.unshift(me.couponParam);
          if (me.param.seqNo) {
            collectArry.listId.unshift(me.couponParam.seqNo);
          } else {
            var mosaic = me.couponParam.mchtId + ',' + me.couponParam.couponId;
            collectArry.listId.unshift(mosaic);
          }
          Storage.set("collect_info", collectArry)
        } else {
          this.collectStatus = false;
          Toast({
            message: '取消收藏',
            duration: 800
          });
          // console.info(me.collectIndex);
          collectArry.collectList.splice(me.collectIndex, 1)
          collectArry.listId.splice(me.collectIndex, 1)
          Storage.set("collect_info", collectArry)
        }
      },
      //商户广告
      shopBanner: function () {
        var me = this;
        // console.log(me.param)
        getData2.shopBanner({
          method: 'post',
          data: {
            "aoData": "",
            "mchtId": me.param.mchtId,
            "state": ""
          }
        }).then(function (rep) {
          // console.log(1111)
          me.banner = rep.content.list;
        })
      }
      /**
       * 获取信息
       */
    }
  }
</script>
<style scoped>
  .mer_position p {
    position: relative;
  }

  .mer_position p span {
    max-height: 2.5rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    position: absolute;
    top: 50%;
    transform: translateY(-50%)
  }

  .card_info::after {
    display: block;
    content: '';
    clear: both;
    height: 0.6rem;
  }

  .card_info .card_name {
    width: -webkit-calc(100% - 3rem);
    width: calc(100% - 3rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .info_pad {
    line-height: 1.5rem;
    height: 1.4rem
  }

  .card_info .color_gray {
    margin-top: 0.2rem;
  }

  .info_pad_shop {
    line-height: 1.9rem;
  }

  /*9-27新增*/

  .new_num {
    color: #999;
    font-size: 0.85rem;
    padding-left: 0.8rem;
    overflow: hidden;
    line-height: 1.5rem;
    height: 1.4rem;
  }

  .shop_core {
    padding: 0.4rem 0 0.3rem;
  }
</style>
